<?php
include("../main/config.inc.php");
$link = mysql_connect(_DB_HOST,_DB_USER,_DB_PASSWORD);
mysql_select_db(_DB_NAME,$link);

include("../main/phpArmory.class.php");

$armory = new armory();
$myguild = $armory->guildFetch("Raminghi di Azeroth","Runetotem");

$member = $myguild['guildinfo']['guild']['members']['character'];
	
if(mysql_query("TRUNCATE TABLE main_pg"))
{	
	foreach($member as $gildano)
	{
			$query = "INSERT INTO main_pg set 
			pgname='".utf8_decode($gildano['attributes']['name'])."',
			pgclass='".$gildano['attributes']['class']."',
			pgrace='".$gildano['attributes']['race']."',
			pggender='".$gildano['attributes']['gender']."',
			pglevel='".$gildano['attributes']['level']."',
			pgrank='".$gildano['attributes']['rank']."',
			pgclassid='".$gildano['attributes']['classid']."',
			pgraceid='".$gildano['attributes']['raceid']."',
			updatecomplete=0";
			
			if(mysql_query($query,$link))
				Echo "Inserito<br>";
			else 
				Echo "Non Inserito:".mysql_error($link)."<br>";
			
	}
}


?>